<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        {{time | formate}}
    </div>
    <script src="./js/vue.js"></script>
    <script>
        // 过滤器的概念需要总结进入理论题
        new Vue({
            data: {
                time: '2020-01-02 12:11:50'
            },

            filters: {
                formate(val) {
                    // console.log(val)
                    let date = new Date(val)
                    let year = date.getFullYear()
                    let month = date.getMonth() + 1
                    let day = date.getDate()
                    return `${year}-${month}-${day}`
                }
            }
        }).$mount('#app')


    </script>
</body>
</html>